class api {
    //构造方法
    constructor({ curl }) {
        this.curl = curl
    }

    // 获取部门列表 及子级部门列表
    // https://open-doc.dingtalk.com/docs/doc.htm?spm=a219a.7629140.0.0.HYQphy&treeId=385&articleId=106817&docType=1#s0
    async list(id) {
        return await this.curl('/department/list', {
            fetch_child: true,
            id
        });
    }


    // 获取部门详情 https://open-doc.dingtalk.com/docs/doc.htm?spm=a219a.7629140.0.0.jG7Nc8&treeId=385&articleId=106817&docType=1#s1
    async get(id) {
        return await this.curl('/department/get', { id });
    }
}

module.exports = api